<?php if (isset($iresult) && COUNT($iresult) > 0){ ?>
<div id="example"></div>
<script>
</script>

<?php } else { ?>
	  <link href="<?php $this->path('css/jquery.tagsinput.css');?>" rel="stylesheet" media="all">
	  <script type="text/javascript" src="<?php $this->path('js/jquery.tagsinput.js');?>"></script>
		<form class="form_style registed" style="margin-top:0px;width:97%;height:90%;overflow:auto;" onsubmit="return false">
				<div class="entry_content">
					<div class="your_review">
						<strong>Name</strong><br/>
						<input type="text" name="" class="" value="<?php echo $result['iname']; ?>" /><br/>
						<strong>Tag</strong>
						<input type="text" name="tag" class="" value="" placeholder="Add a tag..."/><br/>
					</div><!-- .your_review -->
					<div class="text_review">
						<strong>Description</strong><sup class="surely" style="font-size:x-small;">Note: HTML is not supported!</sup><br/>
						<textarea name="text" style="width:95%;height:auto;overflow:auto;resize:none;min-height:150px;"><?php echo $result['description']; ?>
						</textarea>
					</div><!-- .text_review -->
					<div class="ava_price" style="height:300px;">
						<?php 
						$edit = 1;
						$this->render2(CP_BAS . 'pos/inventory/supplier/index.php');
						 ?>
					</div><!-- .ava_price -->
					<br />
					<div class="clear"></div>
					<br />
					<hr />
					<strong>Pricing</strong><br />
        			<table style="border:0px">
        				<tr>
        					<td class="ui-text-center">Supplier Price</td>
        					<td style="width:15px"></td>
        					<td class="ui-text-center">Markup (%)</td>
        					<td style="width:15px"></td>
        					<td class="ui-text-center">Whole Sale Price</td>
        				</tr>
        				<tr>
        					<td><input name="wholesale_price2"  type="text" style="width: 80%;margin-left: auto !important;margin-right: auto !important;display: block;" value="<?php echo $result['whole_sale_price']*100/110; ?>" id="sc" /></td>
        					<td class="ui-text-center">X</td>
        					<td class="ui-text-center">10</td>
        					<td class="ui-text-center">=</td>
        					<td><input name="wholesale_price" type="text" style="width: 80%;margin-left: auto !important;margin-right: auto !important;display: block;" value="0.00" id="wsp" /></td>
        				</tr>
        				<tr>
        					<td class="ui-text-center">Supplier Price</td>
        					<td style="width:15px"></td>
        					<td class="ui-text-center">Markup (%)</td>
        					<td style="width:15px"></td>
        					<td class="ui-text-center">Retail Sale Price</td>
        				</tr>
        				<tr>
        					<td><input name="retail_price2"  type="text" style="width: 80%;margin-left: auto !important;margin-right: auto !important;display: block;" value="<?php echo $result['retail_price']*100/125; ?>" id="sc2" /></td>
        					<td class="ui-text-center">X</td>
        					<td class="ui-text-center">25</td>
        					<td class="ui-text-center">=</td>
        					<td><input name="retail_price" type="text" style="width: 80%;margin-left: auto !important;margin-right: auto !important;display: block;" value="0.00" id="rp" /></td>
        				</tr>
        			</table>
					<input type="submit" style="float:right;margin-right:0px;" value="Save" />
					<div class="clear"></div>
				</div><!-- .entry_content -->
				</form>
<script>
$(document).ready(function(){
	$('input[name=tag]').tagsInput({'width':'auto', 'interactive':true, 'maxChars' : 25});
	var comp = function(){
	var x1 = $('#sc');
	var x2 = $('#sc2');
	var x3 = $('#wsp');
	var x4 = $('#rp');
	var r = x1.val() * 110 / 100;
	var r2 = x2.val() * 125 / 100;
	
	if( isNaN(r) ){
		x3.val(0);
		x1.val(0);
	}else
		x3.val(formatCurrency(r));
		
	if( isNaN(r2) ){
		x4.val(0);
		x2.val(0);
	}else
		x4.val(formatCurrency(r2));
}
comp();
$('#sc').change(function(){comp()}).blur(function(){$(this).val(formatCurrency($(this).val()))});
$('#sc2').change(function(){comp()}).blur(function(){$(this).val(formatCurrency($(this).val()))});
$('#wsp').change(function(){comp()}).blur(function(){$(this).val(formatCurrency($(this).val()))});
$('#rp').change(function(){comp()}).blur(function(){$(this).val(formatCurrency($(this).val()))});
});
</script>
<?php } ?>